/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ui.object;

import javax.microedition.lcdui.Graphics;

/**
 *
 * @author Mathieu
 */
public class Croix {
    private int mX, mY;
    private int mState;
    private Integer colour;
    private boolean isMine;

    public Croix(boolean isMine) {
       this.isMine=isMine;
    }
    
    public int getMX() {
        return mX;
    }

    public void setMX(int mX) {
        this.mX = mX;
    }

    public int getMY() {
        return mY;
    }

    public void setMY(int mY) {
        this.mY = mY;
    }

    public int getMState() {
        return mState;
    }

    public void setMState(int mState) {
        this.mState = mState;
    }

    public boolean isIsMine() {
        return isMine;
    }

    public void setIsMine(boolean isMine) {
        this.isMine = isMine;
    }

    public Integer getColour() {
        if(colour==null)
        {
            if(isMine)
                colour=new Integer(0xFF0000);
            else
                colour=new Integer(0x000000);
        
        }
        return colour;
    }

    public void setColour(Integer colour) {
        this.colour = colour;
    }
    
    
    public void draw(Graphics g){
        
        int lastColor=g.getColor();
        g.setColor(getColour().intValue());
        g.drawLine(mX, mY, mX - 10 + mState, mY - 10);
        g.drawLine(mX, mY, mX + 10, mY - 10 + mState);
        g.drawLine(mX, mY, mX + 10 - mState, mY + 10);
        g.drawLine(mX, mY, mX - 10, mY + 10 - mState);
        g.setColor(lastColor);
    }

    public String toString() {
        return "X:"+getMX()+" Y:"+getMY();
    }
    
    
}
